const https = require('node:https');
const hx = require("hbuilderx");
module.exports = function(url) {
	return new Promise((resolve, reject) => {
		https.get(url, (res) => {
			let req = ''
			res.on('data', (e) => {
				req += e
			});
			res.on('end', () => {
				let data = JSON.parse(req)
				resolve(data)
			})
			res.on('error', (err) => {
				hx.window.showErrorMessage('未知错误,请重试');
				reject(err)
			})
		})
	})
}